package io;

import com.sun.scenario.effect.impl.sw.sse.SSEBlend_SRC_OUTPeer;

import java.io.*;
import java.util.Scanner;

public class NoteDemo {
    public static void main(String[] args)throws IOException {
        Scanner scan = new Scanner(System.in);
        System.out.println("输入文件名：");
        String name = scan.nextLine();
        PrintWriter pw = new PrintWriter(
                new BufferedWriter(
                        new OutputStreamWriter(
                                new FileOutputStream(name),"UTF-8"
                        )
                ),true
        );
        System.out.println("请开始输入内容，单独输入exit退出");
        while (true){
            String line = scan.nextLine();
            if("exit".equals(line)){
                break;
            }
            pw.println(line);
            pw.flush();
        }
        System.out.println("输入完毕");

        pw.close();






    }
}
